<template>
  <ElSelect filterable clearable :="$attrs">
    <ElOption v-for="item in options" :key="item.customerId" :label="item.khmc" :value="item.khmc" />
  </ElSelect>
</template>

<script setup lang="ts">
import { ref, onMounted, watch } from 'vue'
import { ElSelect, ElOption } from 'element-plus'
import {getCustomerList} from '../api'

interface Props {
  data: any;
}
const props = withDefaults(defineProps<Props>(), {
  data: () => ({}),
})

const options = ref<Array<{ customerId: number,khmc: string }>>([])

const getOptions = () => {
  getCustomerList().then(
      res => {
        options.value = res
      }
  )

}

onMounted(() => {
  getOptions()
})
</script>